import { ApiCall } from "tsrpc";
import { ReqAttackBoss, ResAttackBoss } from "../../../shared/master/word/PtlAttackBoss";
import { player } from "../../../model/fight/body/player";
import { template } from "../../../shared/master/MsgAction";

export default async function (call: ApiCall<ReqAttackBoss, ResAttackBoss>) {
    call.succ({})
    let user = call.req._player as player;
    if(user.is_die()){
        await user.callApi('word/ResLife',{})
        if(user.is_die()){
            user.sendMsg(template.default,'你已死亡请先[复活].')
            return;
        }
    }
    
    let word = user.getPosition().getWord();
    word.bossCls.attack(user);
}